<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	<#import "/page.ftl" as page />
	<script type="text/javascript" src="/js/discuss.js" charset="UTF-8"></script>
	<link rel="stylesheet" href="/css/looktable.css" type="text/css">
	<#include "/head.ftl"/>
		<div class="content">
				<div class="tab">
					<div class="tab-header">
						<a onclick="back(this)" title="返回" class="btn btn-setting">
							<i class="iconfont icon-undo"></i>
						</a> 
						<a title="刷新" class="btn btn-setting" onclick="refresh(this)">
							<i class="iconfont icon-refresh"></i>
						</a>
					</div>	
					<div class="pre_allcoments">
						<div class="allcoments">
							<!--          		
				            	描述：发帖内容
				            -->
							<div style="border-bottom: 1px solid #eeeeee;">
								<div class="allcoments-head">
									<p style="text-indent: 1em;">
										<img alt="" src="/file/image/${discuss.user.photo}">
										<span style="font-size: 12px;color: #999;">${discuss.user.name} 于  ${discuss.pushTime} 发布</span>
										<span id="delete" onclick="delete_discuss(this)">删除</span>
									</p>
								</div>
									
								<div class="allcoments-content">
									<dl>					
										<dt>
											${discuss.title}
										</dt>
										<dd>
											${discuss.content}
										</dd>
									</dl>
								</div>
								
								<div class="allcoments-foot" >
									<#if vote.style==0>
									<span class="vote-style">单选</span>
									<#else>
									<span class="vote-style">多选，最多${vote.style+1}项</span>	
									</#if>
									<div class="allcoments-foot-show-view">
										<span>共${count}票</span>
									</div>
								</div>
								<#if voted == "success">
									<div class="not_vote">
										<#list (contents) as contents>
											<div class="select_vote">
												<#assign x="${contents.users?size/count*100}%">
												<div class="color_bar"  style="width: ${x};"></div>
													<#list contentId as contentId>
														<#if contentId.id == contents.id>
															<i class="iconfont icon-right" style="font-weight: bolder;"></i>
														</#if>
													</#list>
													<span>${contents.vcontent}</span>
													<span class="vote_num">${contents.users?size}票</span>
											</div>
										</#list>
									</div>
									<div class="vote_end_time pre_time">
										截止时间：${vote.vendTime}
									</div>
									<div class="vote_people">
										<#list users as user>
											<#if user.photo?? && user.photo!=''>
												<img src="/file/image/${user.photo}" width="20px" height="20px">
											<#else>
												<img src="/images/default-head.jpg" width="20px" height="20px">
											</#if>
										</#list>
										已投票
									</div>
								<#else>
									<form method="get" id="commitid">
									<div class="votes" name="${vote.style+1}" data-url="${requestURI}">
										<#list (contents) as contents>
											<div class="select_vote">
												<i id="not_selected" class="iconfont icon-circle1"></i>
												<i id="yes_selected" class="iconfont icon-success_fill"></i>
												<input type="checkbox" value="${contents.id}" name="selectedid">
												<span>${contents.vcontent}</span>
											</div>
										</#list>
									</div>
									<div class="vote_end_time pre_time">
										截止时间：${vote.vendTime}
									</div>
									<div class="btn-center"><button class="sure_vote">投票</button></div>
									</form>
								</#if>
								
							</div>
							<!--          	
				            	描述：评论回复
				            -->
							<div>
								<div class="sort-head">
									<p>${discuss.commentNum!"0"}个评论</p>
									<div class="sort-head-right">
										<div class="sort-label">
											按${str}排序
											<i class="iconfont icon-icon-caret-down" id="icon-down" style=" padding-left: 2px; font-size: 12px;"></i>
										</div>
										<ul class="drift">
											<a onclick="pageSort('${requestURI}','time,desc')">时间排序</a>
											<hr>
											<a onclick="pageSort('${requestURI}','replyNum,desc')">回复数排序</a>
											<hr>
											<a onclick="pageSort('${requestURI}','thumbNum,desc')">赞数排序</a>
											<li class="arrow"></li>
										</ul>
									</div>
								</div>
								<#list comments.content as comments>
									<div class="answer">
										<dl class="answer-user-message">
											<dt  style="float: left;width: 40px;height: 35px;">
												<img src="/file/image/${comments.user.photo}" style="width: 30px;height: 30px;border-radius: 50%;">
											</dt>
											<dd>
												<a style=" color: #428bca;">${comments.user.name}</a>
												<span style="margin: 0 10px;font-size: 12px;">${comments.time}</span>
											</dd>
											<div class="share-bar">
												<div class="share-bar-answer">
													<span id="comment">回复&nbsp;<span class="comment_num">${comments.replys?size}</span><i class="iconfont icon-pinglun1" style="font-size: 12px;"> </i></span>
													
													<#assign user=0>
													<#list comments.thumbs as thumbs>
														<#if thumbs.user==userinfo>
															<#assign user=1>
														</#if>
													</#list>
													<#if user==0>
														<span id="thumbs" data-comment-id="${comments.id}">赞&nbsp;<span class="thumb_num">${comments.thumbs?size}</span><i class="iconfont icon-praise"> </i><i class="iconfont icon-praise_fill" id="paopao"> </i></span>
													<#else>
														<span id="thumbs" style="color: #e61818" data="yizan">赞&nbsp;<span class="thumb_num">${comments.thumbs?size}</span><i class="iconfont icon-praise"> </i></span>
													</#if>
												</div>
											</div>
										</dl>
										<div class="answer-content">
											<p style="font-size: 12px; font-family:微软雅黑;">${comments.content}</p>
										</div>
											<div class="comments" data="${comments.id}" data-name="${userinfo.name}">
												<input type="text" name="my_commtens" placeholder="填写回复...">
												<span class="sure_comments" onclick="write_comment_content(this)">回复</span>
												<#list comments.replys as reply>
												<dl class="user_comments">
													<dt>
														<#if reply.user.photo??&&reply.user.photo!=''>
									    					<img class="user-head" alt="用户头像" src="/file/image/${reply.user.photo}" width="30px" height="30px">
														<#else>
									    					<img class="user-head" alt="用户头像" src="/images/default-head.jpg" width="30px" height="30px">
														</#if>
													<dd><span>${reply.user.name}</span>${reply.content}</dd>
													<dd class="comments_time">${reply.time}</dd>
												</dl>
												</#list>
											</div>
									</div>
								</#list>
									<@page.page url=requestURI pager=comments/>
							</div>
							<input type="hidden" name="myphoto" value="${userinfo.photo}">
						</div>
						<form method="post" id="mycomment">
							<div class="my_write_comment">
								<textarea id="comment_content" rows="8" cols="150" placeholder="评论..." name="content"></textarea>
							</div>
							<div class="link_comment" data="${discuss.type}" discussId="${discuss.id}" >
								<input type="hidden" name="discussUser" value="${discuss.user.id}">
								<input type="hidden" name="user" value="${userinfo.id}">
								<input type="hidden" name="discuss" value="${discuss.id}">
								<button class="btn sure_click_comments" onclick="comment_url()" style="background: #3c8dbc;">我要评论</button>
							</div>
						</form>
					</div>
				</div>
		</div>
</body>
</html>